<!doctype html>
<html lang="en" >
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <link rel="icon" sizes="144x144" type="image/png" href="/touch-icon-144.png">
  <link rel="apple-touch-icon" sizes="57x57" href="/touch-icon.png">
  <link rel="apple-touch-icon" sizes="114x114" href="/touch-icon.png">
  <link rel="apple-touch-icon" sizes="72x72" href="/touch-icon-144.png">
  <link rel="apple-touch-icon" sizes="144x144" href="/touch-icon-144.png">
  <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Lobsters">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="referrer" content="always">
  <meta name="theme-color" content="#AC130D">
  <meta name="story-flags" content="<%=  Vote::STORY_REASONS.to_json %>">
  <meta name="comment-flags" content="<%=  Vote::COMMENT_REASONS.to_json %>">

  <% if @meta_tags %>
    <% @meta_tags.each do |k,v| %>
      <meta name="<%= k %>" content="<%= v %>">
    <% end %>
  <% end %>
  <link rel="shortcut icon" href="/favicon.ico">
  <% if controller_name == "stories" && action_name == "show" %>
    <%= tag :link, href: Routes.title_url(@story), rev: :canonical, rel: "self alternate shorter shorturl shortlink" %>
  <% end %>
  <title><%= @title.present? ? "#{@title} | " : "" %><%=
    Rails.application.name %></title>

  <%= stylesheet_link_tag "application" %>
  <%= stylesheet_link_tag (@user&.prefers_color_scheme || "system") + "-" + (@user&.prefers_contrast || "system") %>
  <%= stylesheet_link_tag "tom-select", "data-turbo-track": "reload" %>
  <%= stylesheet_link_tag "TomSelect_remove_button", "data-turbo-track": "reload" %>

  <% if @user %>
    <%= javascript_importmap_tags %>
  <% end %>

  <%= csrf_meta_tags %>
  <% if @rss_link %>
    <link rel="alternate" type="application/rss+xml"
      title="<%= @rss_link[:title] %>" href="<%= @rss_link[:href] %>">
  <% end %>
  <% if @comments_rss_link %>
    <link rel="alternate" type="application/rss+xml"
      title="<%= @comments_rss_link[:title] %>"
      href="<%= @comments_rss_link[:href] %>">
  <% end %>
  <meta name="robots" content="noai, noimageai">
</head>
<body data-username='<%= @user.try(:username) %>'>
  <header id="nav">
    <a id="logo" style="<%= @traffic_style %>" href="/" title="<%= Rails.application.name %> (Current traffic: <%= @traffic_intensity.to_i %>%)"></a>
    <%= @traffic_novelty %>

    <div class="navholder">
      <nav class="links">
        <%= link_to_different_page 'Active', active_path %>
        <%= link_to_different_page 'Recent', recent_path %>
        <%= link_to_different_page 'Comments', comments_path %>

        <% if @user && @user.can_submit_stories? %>
          <%= link_to_different_page 'Submit', new_story_path %>
        <% end %>

        <%= link_to_different_page 'Search', search_path %>


        <% if @user %>
          <% if @user.inbox_count > 0 %>
            <%= link_to raw("Inbox&nbsp;<span class='inbox_unread'>#{@user.inbox_count}</span>"), inbox_path, class: 'inbox corner' %>
          <% else %>
            <%= link_to "Inbox", inbox_path, class: 'inbox corner' %>
          <% end %>

          <%= link_to_different_page 'Threads', threads_path %>
          <%= link_to_different_page 'Saved', saved_path %>
          <%= link_to_different_page raw("#{@user.username}&nbsp;<span class='karma'>(#{@user.karma})</span>"), settings_path %>
        <% else %>
          <%= link_to_different_page 'Login', login_path, class: 'corner' %>
        <% end %>
      </nav>
    </div>

    <nav class="corner">
      <% if @user %>
        <% if @user.inbox_count > 0 %>
          <%= link_to raw("&#9993;&nbsp;<span class='inbox_unread'>#{@user.inbox_count}</span>"), inbox_path, class: 'inbox' %>
        <% else %>
          <%= link_to raw("&#9993;"), inbox_path, class: 'inbox' %>
        <% end %>
      <% else %>
        <%= link_to 'Login', login_path, class: 'corner' %>
      <% end %>
    </nav>
  </header>

  <% if content_for? :subnav %>
    <header id="subnav">
      <%= yield :subnav %>
    </header>
  <% end %>

  <div id="inside">
    <% if @title.present? && @title_h1 %>
      <h1 class="<%= @title_class %>"><%= @title %></h1>
    <% end %>

    <% [ :error, :success, :notice ].each do |f| %>
      <% if flash[f].present? %>
        <div class="flash-<%= f %>"><%= flash[f] %></div>
      <% end %>
    <% end %>

    <%= yield %>
  </div>

  <footer>
      <span id="office-hours-live">
        <% if File.exist?('tmp/office_hours_live.txt') %>
          The <a href="https://lobste.rs/s/zzprkr/weekly_lobsters_office_hours">office hours stream</a> is <a href="https://www.twitch.tv/pushcx">currently live ⏵</a>
      <% end %>
    </span>

    <nav>
      <%= link_to 'About', about_path %>
      <% if !@user && Rails.application.open_signups? %>
        <a href="/invitations/open">Join <%= Rails.application.name %></a>
      <% end %>
      <% if @user && @user.can_see_invitation_requests? &&
            (iqc = InvitationRequest.verified_count) > 0 %>
        <a href="/invitations">Invitation Queue (<%= iqc %>)</a>
      <% end %>
      <%= link_to 'Tags', tags_path %>
      <% if @user && @user.is_moderator? && (hrc = HatRequest.count) > 0 %>
        <%= link_to "#{hrc} Hat Requests", hat_requests_path, class: 'mod' %>
      <% end %>
      <%= link_to 'Filter', filters_path %>
      <%= link_to 'Moderation Log', moderations_path %>
    </nav>
  </footer>

  <span id="iab-pcm-sdk"></span><span id="iab-autofill-sdk"></span>
</body>
</html>
